package com.java.escape.stringmethods;

import org.apache.commons.lang3.StringUtils;

import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Locale;

/**
 * @ClassName Demo
 * @Description StringUtils(Apache common.lang)
 * @Author wyp
 * @Date 2023/10/11 9:55
 * @Version 1.0
 */
public class Demo {
    public static void main(String[] args) {
        String str = "hello62,world";
        String abbreviate = StringUtils.abbreviate(str, 10, 8);
        String capitalize = StringUtils.capitalize(str);
        String email = "wypbapoint@gmail.com";
        boolean matches = email.matches("^[a-zA-Z0-9]+[-| a-z0-9A-Z._]+@([a-zA-Z0-9]+(-[a-z0-9A-Z]+)?\\.)+[a-z]{2,}$");
        System.out.println(abbreviate);
        System.out.println(capitalize);
        System.out.println(matches);
        byte[] bytes = str.getBytes(StandardCharsets.UTF_8);
        System.out.println(Arrays.toString(bytes));
//        String intern = str.intern();
//        System.out.println(intern);
//        boolean equals = str.equals(intern);
//        System.out.println(equals);
        String abc = "hello,world";
//        boolean equals1 = abc.equals(intern);
        String s = "hello,world";
//        System.out.println(equals1);
//        System.out.println(s.equals(intern));
        String lowerCase = str.toLowerCase(Locale.ROOT);
        String lowerCase1 = str.toUpperCase();
        System.out.println(lowerCase1);
        boolean world = str.startsWith("world", 5);
        System.out.println(world);
        int i = str.codePointAt(0);
        System.out.println(i);
        int i1 = str.indexOf(5);
        int i2 = str.indexOf("world");
        System.out.println(i1);
        System.out.println(i2);
    }
}
